<template>
  <div>
    <home-header ></home-header>
    <home-swiper :swiperList="swiperList"></home-swiper>
    <home-icons :iconsList="iconsList"></home-icons>
    <home-recommend :recommendList="recommendList"></home-recommend>
    <home-weekend :weekendList="weekendList"></home-weekend>
  </div>
  <!--&lt;!&ndash;在Vue中通常使用router-link 跳转页面&ndash;&gt;-->
  <!--<router-link to="/list">列表页</router-link>-->
</template>

<script>
  import HomeHeader from './components/Header.vue'
  import HomeSwiper from './components/Swiper.vue'
  import HomeIcons from './components/Icons.vue'
  import HomeRecommend from './components/Recommend.vue'
  import HomeWeekend from './components/Weekend.vue'
  import axios from 'axios'
  export default {
    name:'Home',
    components:{
      HomeHeader,
      HomeSwiper,
      HomeIcons,
      HomeRecommend,
      HomeWeekend
    },
    data(){
      return{
        swiperList:[],
        iconsList:[],
        recommendList:[],
        weekendList:[]
      }
    },
    methods:{
      getHomeInfo(){
        axios.get('./api/index.json').then(this.getHomeInfoSucc)
      },
      getHomeInfoSucc(res){
        if(res.data.ret && res.data){
          this.swiperList = res.data.data.swiperList;
          this.iconsList = res.data.data.iconList;
          this.recommendList = res.data.data.recommendList;
          this.weekendList = res.data.data.weekendList;
        }
      }
    },
    mounted(){
      this.getHomeInfo()
    }
  }
</script>

<style>

</style>
